When recreating the record for dom 0, read the current VCPU settings from Xen,
authorEwan Mellor <ewan@xensource.com>
Wed, 13 Dec 2006 14:36:36 +0000 (14:36 +0000)
committerEwan Mellor <ewan@xensource.com>
Wed, 13 Dec 2006 14:36:36 +0000 (14:36 +0000)
rather than from the store, allowing boot-time configuration to take precedence.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/XendDomainInfo.py

index 6a40911e0437ec9a64ec5038ddd3171b6a6433ee..e7ef22b154e04209e1af219c857b01382d146aab 100644 (file)
@@ -167,7 +167,7 @@ def recreate(info, priv):
 
     @param xeninfo: Parsed configuration
     @type  xeninfo: Dictionary
-    @param priv: TODO, unknown, something to do with memory
+    @param priv: Is a privileged domain (Dom 0)
     @type  priv: bool
 
     @rtype:  XendDomainInfo
@@ -381,7 +381,7 @@ class XendDomainInfo:
         @type    dompath: string
         @keyword augment: Augment given info with xenstored VM info
         @type    augment: bool
-        @keyword priv: Is a privledged domain (Dom 0) (TODO: really?)
+        @keyword priv: Is a privileged domain (Dom 0)
         @type    priv: bool
         @keyword resume: Is this domain being resumed?
         @type    resume: bool
@@ -647,6 +647,8 @@ class XendDomainInfo:
         if priv:
             augment_entries.remove('memory')
             augment_entries.remove('maxmem')
+            augment_entries.remove('vcpus')
+            augment_entries.remove('vcpu_avail')
 
         vm_config = self._readVMDetails([(k, XendConfig.LEGACY_CFG_TYPES[k])
                                          for k in augment_entries])
@@ -664,6 +666,14 @@ class XendDomainInfo:
                 else:
                     self.info[arg] = val
 
+        # For dom0, we ignore any stored value for the vcpus fields, and
+        # read the current value from Xen instead.  This allows boot-time
+        # settings to take precedence over any entries in the store.
+        if priv:
+            xeninfo = dom_get(self.domid)
+            self.info['vcpus_number'] = xeninfo['online_vcpus']
+            self.info['vcpu_avail'] = (1 << xeninfo['online_vcpus']) - 1
+
         # read image value
         image_sxp = self._readVm('image')
         if image_sxp: